package learnjava.concur.chapter6;

import lombok.extern.slf4j.Slf4j;

@Slf4j(topic = "test_join")
public class TestJoin {

    public static void main(String[] args) throws InterruptedException {

        log.debug("main start");

        Thread t1 = new Thread(()->{
            log.debug("t1 start");
            try {
                Thread.sleep(10000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            log.debug("t1 end");
        },"t1");

        Thread t2 = new Thread(()->{
            log.debug("t2 start");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            log.debug("t2 end");
        },"t2");

        t1.start();
        t2.start();
        log.debug("t1.join");
        t1.join();
        log.debug("t2.join");
        t2.join();
        log.debug("main end");
    }
}
